#ifndef __PlayerEntity_H_
#define __PlayerEntity_H_

#include "AnimatedEntity.h"
#include "LivingEntity.h"

#include "irrlicht.h"
using namespace irr;
using namespace core;

//#define PLAYER_ID 0x01

/*!
	The PlayerEntity class provides a specialized Entity which means to be controlable for a player.
	A camera can be attached to the player.
*/
class PlayerEntity: virtual public AnimatedEntity, virtual public LivingEntity
{
	friend class InputReceiver;

	protected:
	double movement__;		/**< Set by the InputReceiver, used to determine the new position of the player. */
	double turn_angle__;		/**< Set by the InputReceiver, used to determine the new orientation of the player. */
	double turn_from_mouse__;	/**< Set by the InputReceiver, used to determine the new orientation of the player (with mouse). */

	ICameraSceneNode* cam__ ;	/**< A camera scene node which is a child of Entity::node__. */
	ISceneNode* lookUp__;		/**< An intermediate scene node to make the camera to look up and down (via rotating around Z axis). lookUp__ is a child scene node of node__, and cam__ is a child scene node of lookUp__. */
	double camera_distance__;	/**< updated via PlayerEventReceiver, using mouse wheel, to set a sort of zoom. */

	public:
	/*! Constructor. Using the same arguments as for AnimatedEntity's constructor. */
	PlayerEntity(const irr::core::string<c8>& entityModel, const irr::core::string<c8>& entitySkin, const irr::core::string<c8>& weaponModel, const irr::core::string<c8>& weaponSkin);
	/*! Destructor. Just free and remove the nodes relative to the camera (the 3rd person view camera) if needed. */
	virtual ~PlayerEntity();

	/*! Create the nodes relative to the 3rd person view camera. */
	void createCamera();
	/*! set the 3rd person view camera active, creating it if needed. */
	void set3rdPersonView();
	/*! returns true if the 3rd person view camera is active. */
	bool isCameraActive();
	
	/*! attack the entity facing the player if there is one */
	bool attack() ;

	/*! This method updates the player's position and orientation and sets an appropriate animation (doesn't launch the run animation when standing for exemple). */
	virtual void update();
	
};

#endif

